//
//  DesingerDetailHeaderView.m
//  BigJoy
//
//  Created by Rowling on 2017/7/12.
//  Copyright © 2017年 Rowling. All rights reserved.
//

#import "DesingerDetailHeaderView.h"
#import "SingleImageCell.h"
@interface DesingerDetailHeaderView()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (weak, nonatomic) IBOutlet UIView *contentView;
@property (nonatomic,strong) UICollectionView *collectionView;

@end
@implementation DesingerDetailHeaderView
-(UICollectionView *)collectionView {
    if (_collectionView == nil) {
        UICollectionViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc]init];
        layout.minimumInteritemSpacing = XMH(10);
        layout.itemSize = CGSizeMake(119, 119);
        layout.sectionInset = UIEdgeInsetsMake(0, XMW(10), 0, XMW(10));
        layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64) collectionViewLayout:layout];
        _collectionView.showsHorizontalScrollIndicator = NO;
        _collectionView.delegate = self;
        _collectionView.dataSource = self;
        _collectionView.backgroundColor = [UIColor whiteColor];
        [_collectionView registerNib:[UINib nibWithNibName:@"SingleImageCell" bundle:nil] forCellWithReuseIdentifier:@"Cell"];
    }
    return _collectionView;
}

-(void)awakeFromNib {
    [super awakeFromNib];
    [self.contentView addSubview:self.collectionView];
}

-(void)layoutSubviews {
    self.collectionView.frame = self.contentView.bounds;
}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 10;
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    SingleImageCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
    return cell;
}


+(instancetype)fastLogin {
    return FastLogin;
}

@end
